Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovsx-client: introduce async ovsx-client provider #10327

Merged
merged 6 commits into from
Oct 28, 2021

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes: #10326.

The pull-request fixes the issue #10326 which was caused by the way the OVSXClient was initialized in the backend. Previously, the client was created statically at a point in which the backend was not able to read the command line arguments in an asynchronous manner. Rather than duplicating the work we do in the frontend, and the use of the "hackish" OVSXAsyncClient the following was used:

The main change is to introduce an OVSXClientProvider which is in charge of providing a promise to an OVSXClient when ready (meaning when we finally read the proper api version and registry url).

How to test

Try the steps highlighted in #10326:

  1. start the application, passing --vscode-api-version=1.40.0 as an argument (sets the api to 1.40.0)
  2. search for gitlens
  3. confirm that the version listed is v10.2.3
  4. install the extension - confirm the version is not updated to v11.2.1 and remains at v10.2.3
  5. confirm that everything works as today, no regressions searching extensions, viewing readme, installing and uninstalling extensions

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto [email protected]

@vince-fugnitto vince-fugnitto added the vsx-registry Issues related to Open VSX Registry Integration label Oct 26, 2021
@vince-fugnitto vince-fugnitto self-assigned this Oct 26, 2021
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that the issue exists on master and is addressed by the changes nicely 👍

I have a suggestion before merging.

@vince-fugnitto vince-fugnitto force-pushed the vf/ovsx-client-provider branch from 9502b0d to 8bdaa21 Compare October 27, 2021 14:35
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

vince-fugnitto and others added 6 commits October 28, 2021 10:56
The commit fixes an issue where previously the backend would never
properly read the cli arguments in time to create the ovsx-client. This
meant that while the api-version was respected when searching in the
view, it was not when installing.

The change removes the use of `OVSXAsyncClient` and instead uses an
`async` provider of `OVSXClient` which will probably be set with the
correct api version and url when ready.

Signed-off-by: vince-fugnitto <[email protected]>
Signed-off-by: vince-fugnitto <[email protected]>
Signed-off-by: vince-fugnitto <[email protected]>
@vince-fugnitto vince-fugnitto force-pushed the vf/ovsx-client-provider branch from 7132a82 to 214f5ee Compare October 28, 2021 14:56
@vince-fugnitto
Copy link
Member Author

@msujew @colin-grant-work the pull-request was further update following some feedback and ideas from @paul-marechal where we now properly wait for the environment and cli arguments to be ready before we set the api-level which is then used when creating the client. The new approach should now properly respect the api-level and no longer rely on timing like it was previously done.

The following should hold true:

  • should work correctly as today when using the default api
  • should respect the environment variable if set for both searching and installing extensions (overriding default)
  • should respect the cli argument if present for both searching and installing extensions (overriding default)

Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know some of it is my own code, but along with @vince-fugnitto's original work it now looks good to me!

We no longer rely on timing and rather explicitly wait for the right data to be set (waiting for the cli arguments to be parsed, fallback to the env if not specified, and finally using a hardcoded default if not in the env.)

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for awaiting proper timing. 👍

@vince-fugnitto vince-fugnitto merged commit bf00fd0 into master Oct 28, 2021
@vince-fugnitto vince-fugnitto deleted the vf/ovsx-client-provider branch October 28, 2021 20:26
@vince-fugnitto vince-fugnitto added this to the 1.19.0 milestone Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vsx-registry Issues related to Open VSX Registry Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vsx: installing does not respect api version
4 participants